package com.xiaozhen.jt809.codec;

import com.xiaozhen.jt809.utils.ByteArrayUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: zhenweisheng
 * @Date: 2020/8/12 13:50
 * @Description:
 */
@Slf4j
@Service
@ChannelHandler.Sharable
public class MsgPackHexDecoder extends ChannelHandlerAdapter {

    @Autowired
    private Byte2MessageDecoder decoder;


    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        ByteBuf byteBuf = (ByteBuf) msg;
        decoder.decode(ctx,byteBuf);
    }

}
